Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Claude 3.7 Sonnet with extended thinking #1370

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

salman1993
Copy link
Collaborator

@salman1993 salman1993 commented Feb 25, 2025

Claude 3.7 Sonnet works out of the box without extended thinking (changes in this PR not needed). To enable extended thinking, we have set some env vars:

cargo build

# configure Anthropic provider with model 'claude-3-7-sonnet-latest'

# start a session
GOOSE_CLI_SHOW_THINKING=true ANTHROPIC_THINKING_ENABLED=true ./target/debug/goose session

# test on a string
GOOSE_CLI_SHOW_THINKING=true ANTHROPIC_THINKING_ENABLED=true ./target/debug/goose run --text "can you explain the code in crates/goose-cli/src/session/output.rs?"

Screenshot 2025-02-24 at 7 08 26 PM

see longer discussion post on reasoning: #1300

@salman1993
Copy link
Collaborator Author

salman1993 commented Feb 25, 2025

tested in goose-server with this script:

  1. Build & start goosed: cargo build; ANTHROPIC_THINKING_ENABLED=true ./target/debug/goosed agent

  2. Run script in new terminal

#!/bin/bash
set -euxo pipefail
IFS=$'\n\t'

# Send request to create an agent
curl --request POST \
  --url http://localhost:3000/agent \
  --header 'Content-Type: application/json' \
  --header 'X-Secret-Key: test' \
  --data '{
    "version": "truncate",
    "provider": "anthropic"
  }'

sleep 5

# Add a system
curl --request POST \
  --url http://localhost:3000/extensions/add \
  --header 'Content-Type: application/json' \
  --header 'X-Secret-Key: test' \
  --data '{
    "type": "builtin",
    "name": "developer"
  }'

sleep 5

# Send a user message 
curl --request POST \
  --url http://localhost:3000/reply \
  --header 'Accept: text/event-stream' \
  --header 'Content-Type: application/json' \
  --header 'X-Secret-Key: test' \
  --header 'x-protocol: data' \
  --data '{
    "messages": [
      {
        "role": "user",
        "content": "what tools do you have?"
      }
    ]
  }'

Output

g:"Let me check what tools are available to me based on the introduction and function descriptions.\n\nBased on the introduction, I have access to the following tools from the developer extension:\n\n1. `developer__shell` - Execute shell commands\n2. `developer__text_editor` - Edit files with operations like view, write, str_replace, and undo_edit\n3. `developer__list_windows` - List available window titles for screen capture\n4. `developer__screen_capture` - Capture a screenshot of a display or window\n\nThese tools allow me to execute commands, work with files, and capture screenshots. I'll provide an overview of these tools to the user."
j:{"signature":"EuYBCkQYAiJAzKcGj8ADFf7uY6hEKcG5tXaIzFUxzdUdJ/+zaeGkJqW4QsI3Owk9uJBAc15g3yugIieKyUUtsGXZCzPLQnHZNBIMy5dHoyx06mewycr1Ggz4IftlvLHc92EdgDkiMAGytyjoe5+6aVXNVOxJfU3jx+lLuXGBcHnyauSE/P9pf8QQ52Pd8iYnz2Ztw2AKtypQzjHmF9arq6bRRDKyTQf4+XyNZOL3HIIj579yr8/YQtkmDSMomCmzDoW3XxxoqOP8vjhSd1aQ3Fq0FLi/idQjsmx8D/SEcufhnQcry0j7mxg="}
0:"# Available Tools\n"
0:"\n"
0:"I currently have access to the following tools from the **developer extension**:\n"
0:"\n"
0:"1. **Shell Command Tool**\n"
0:"   - Executes commands in the shell\n"
0:"   - Returns both output and error messages\n"
0:"   - Commands run in separate processes (directory changes don't persist between calls)\n"
0:"   - Uses ripgrep (`rg`) for efficient file searching\n"
0:"\n"
0:"2. **Text Editor Tool**\n"
0:"   - View file contents\n"
0:"   - Write or overwrite files\n"
0:"   - Replace specific strings in files\n"
0:"   - Undo recent edits\n"
0:"\n"
0:"3. **Window Management Tools**\n"
0:"   - List window titles that can be used with screen capture\n"
0:"   - Capture screenshots of specific displays or windows\n"
0:"\n"
0:"These tools allow me to help you with development tasks such as running commands, editing code files, and capturing screenshots for debugging purposes.\n"
0:"\n"
0:"Is there a specific task you'd like assistance with using these tools?\n"
d:{"finishReason":"stop","usage":{"completionTokens":0,"promptTokens":0}}

@salman1993 salman1993 changed the title feat: Claude 3.7 Sonnet feat: Claude 3.7 Sonnet with extended thinking Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant